-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add OpenAPI 3.x Input Support #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: hawkeyexl <[email protected]>
|
Remove the |
Co-authored-by: hawkeyexl <[email protected]>
I've removed the |
|
Create an OpenAPI definition to test the implementation. If you already have, explain what you've done in detail. |
Co-authored-by: hawkeyexl <[email protected]>
I've added a comprehensive OpenAPI definition in YAML format to test the implementation in commit 1d6ec5b. The implementation already had two JSON-based OpenAPI test files:
I've added a new YAML example (
I've also created a dedicated integration test ( The tests pass successfully, demonstrating that the implementation properly supports both JSON and YAML OpenAPI specifications. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughOpenAPI 3.x integration has been added, enabling the system to detect, parse, and convert OpenAPI JSON/YAML files into Doc Detective test specifications. New utility functions and extensive test suites validate detection, transformation, configuration inheritance, extension handling, and dependency management for OpenAPI-based test generation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Utils
participant OpenAPI
participant TestSpecs
User->>Utils: parseTests([filePaths])
Utils->>Utils: Read file content
alt isOpenApi3File(content, path)
Utils->>OpenAPI: isOpenApi3File(content, path)
OpenAPI-->>Utils: true
Utils->>OpenAPI: transformOpenApiToSpec(doc, path, config)
OpenAPI->>OpenAPI: extractOperations(doc)
OpenAPI->>OpenAPI: transformOperationToTest(...)
OpenAPI-->>Utils: Doc Detective spec object
Utils->>TestSpecs: Add spec to array
else not OpenAPI
Utils->>TestSpecs: Standard test parsing
end
Utils-->>User: [specs]
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
|
@copilot Add detailed documentation about how OpenAPI documents are transformed into Doc Detective tests, including requirements for certain behaviors/methods, logic behind the workflows, and user expectations. |
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
Co-authored-by: hawkeyexl <[email protected]>
I've added comprehensive documentation about OpenAPI transformation in commit a2512a8. The new documentation covers:
The documentation explains how OpenAPI operations are transformed into Doc Detective tests, including the logic behind safety classification, extension processing, and dependency resolution. |
jstjoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Test coverage and all. We should probably add to the test schema over time but this looks solid.
This PR adds support for OpenAPI 3.x specifications as input files for automatic test generation. The implementation allows Doc Detective to directly read OpenAPI files (JSON/YAML) and transform operations into executable test specifications without manual configuration.
Features
OpenAPI Detection & Handling
Safety Classification
x-doc-detective Extension Support
openApischema properties{ "openapi": "3.0.0", "x-doc-detective": { "server": "https://testing.example.com", "validateSchema": true }, "paths": { "/users/{id}": { "delete": { "x-doc-detective": { "safe": true, "before": ["getUser"], "after": ["getAllUsers"] } } } } }Dependency Management
beforeoperations executed as prerequisite stepsafteroperations executed as cleanup stepsoperationIdorpath+methodcombinationImplementation
openapi.jsfor detection and transformationparseTestsinutils.jsto handle OpenAPI filesExample
Given an OpenAPI specification with a GET /users operation:
Doc Detective will automatically generate a test:
{ "id": "getUsers", "description": "Get all users", "steps": [ { "action": "httpRequest", "openApi": { "operationId": "getUsers" } } ] }Fixes #3.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.fwupd.org/usr/bin/fwupdmgr refresh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Summary by CodeRabbit
New Features
Tests
Chores